﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
<link href="~/lib/layui/css/layui.css" rel="stylesheet" />
<script src="~/lib/layui/layui.js"></script>
<script src="~/lib/jquery/dist/jquery.js"></script>
@* <!-- 请勿在项目正式环境中引用该 layui.js 地址 -->
<script src="//unpkg.com/layui@2.9.20/dist/layui.js"></script> *@
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>IMES</title>
</head>
<body>
    @* 导入产品 *@

    <button id="test1">上传文件</button>

</body>
</html>
<!-- 请勿在项目正式环境中引用该 layui.js 地址 -->
<script src="//unpkg.com/layui@2.9.20/dist/layui.js"></script>
<script>
    //导入excel表
    layui.use(['upload', 'layer'], function () {
        var $ = layui.jquery,
            upload = layui.upload,
            layer = layui.layer;

            //上传文件
        upload.render({
            elem: '#test1' //绑定元素
            , url: '@ViewBag.Darius' + '/api/Orders/OrderExpoert' //上传接口
            , accept: 'file' //普通文件
           , done: function (res) {
                //上传完毕回调
                console.log(res);
                layer.msg(res.msg);
                //导入成功后关闭当前弹框
                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                parent.layer.close(index); //再执行关闭
                //刷新当前页面
                window.location.reload();
                
            }
        });
    });

</script>

